from ..common.ui.Selector import Selector
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from ..common.ui.PageElement import PageElement, POLL_FREQUENCY


class Currencybox(PageElement):

    def getValue(self):
        self.wait_element_presence()
        script = "return $(arguments[0]).currencybox('value')"
        values = self._execute_script(script, self._get_web_element())
        return values

    def setValue(self, value):
        self.wait_element_presence()
        script = "$(arguments[0]).currencybox('value', {value})".format(value=value)
        self._execute_script(script, self._get_web_element())

    def get_identification(self):
        identification = {'class': ['form-control'],
                          'data-ui-role': ['currencybox']}
        return identification
